<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body style="padding:10px;">
<p>说明：
    <span>遵循单一职责（一个方法只做一件事)，封装数据返回结果情况可不抽</span>
</p>
<br/>
<p>正例：</p>
<div style="margin:10px;padding:10px;border:1px solid #000000;white-space: pre-line;">
    /**
    * 根据站别体系的id,更新站别体系的有效数量,失效数量
    * @param id
    * @param effectiveNumber 有效数量
    * @param invalidationNumber 失效数量
    */
    private void updateLtgSiteFileSystemNum(Long id, Integer effectiveNumber, Integer invalidationNumber) {
        LtgSiteFileSystem updateFileSystem = new LtgSiteFileSystem();
        updateFileSystem.setId(id);
        if (effectiveNumber != null) {
            updateFileSystem.setEffectiveNumber(effectiveNumber);
        }
        if (invalidationNumber != null) {
            updateFileSystem.setInvalidationNumber(invalidationNumber);
        }
        super.setModifyInfo(updateFileSystem);
        this.systemService.updateById(updateFileSystem);
    }

</div>
<br/>
<p>反例：WorkAgeDto workAgeDto 对象可以抽取出一个单独的方法;让calculateWorkAge调用,而非让calculateWorkAge方法干两件事情(1.判断获取workAgeDto对象,2:empInfo设置)</p>
<div style="margin:10px;padding:10px;border:1px solid #000000;white-space: pre-line;">
 <br/>   /**
 <br/>   * 导入员工档案计算工龄
 <br/>   *
 <br/>   * @param empInfo
 <br/>   */
 <br/>   private void calculateWorkAge(EmpInfo empInfo) {
 <br/>       //是否累加工龄
 <br/>       String isSumWorkage = empInfo.getIsSumWorkAge();
 <br/>       WorkAgeDto workAgeDto = new WorkAgeDto();
 <br/>       if (String.valueOf(Constants.YnType.YES.getValue()).equals(isSumWorkage)) {
 <br/>           Map&lt;String, Object&gt; map = new HashMap&lt;&gt;();
 <br/>           map.put(&quot;work_years_entry_date&quot;, empInfo.getWorkYearsEntryDate());
 <br/>           if (ToolUtil.isEmpty(empInfo.getWorkYearsEntryDate())) {
 <br/>               map.put(&quot;work_years_entry_date&quot;, empInfo.getEntryDate());
 <br/>           }
 <br/>           map.put(&quot;entry_date&quot;, empInfo.getEntryDate());
 <br/>           workAgeDto = empEmployBiz.getSumWorkAgeDays(empInfo.getId(), map, null);
 <br/>       } else {
 <br/>           if (ToolUtil.isNotEmpty(empInfo.getWorkYearsEntryDate())) {
 <br/>               workAgeDto = empEmployBiz.setWorkDateDto(empInfo.getWorkYearsEntryDate(),new Date());
 <br/>           }
 <br/>       }
 <br/>       if (ToolUtil.isNotEmpty(workAgeDto)) {
 <br/>           empInfo.setWorkAgeValue(workAgeDto.getWorkAgeValue());
 <br/>           empInfo.setWorkAgeMouth(workAgeDto.getMouth());
 <br/>           empInfo.setWorkAgeYear(workAgeDto.getYear());
 <br/>       }
 <br/>   }

</div>
</body>
</html>